<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<c:set value="${pageContext.request.contextPath }" var="cPath" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>board/boardEdit.jsp</title>
<LINK type="text/css" rel="stylesheet" href="${cPath }/css/main.css"/>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="${cPath }/se2/js/HuskyEZCreator.js" charset="utf-8"></script>
<SCRIPT type="text/javascript">
<c:if test="${!empty msg}">
alert("${msg}");
</c:if>

function deleteBoardqa() {
	var form = document.getElementById("editForm");
	form.action = "${cPath}/boardqaDelete.do";
	form.submit();
}
</SCRIPT>
</head>
<body>
<div id="imgt3">
	<img src="${cPath }/css/b4.png" width="35%" align="left"><br>
	<br><br><br><br>
	</div>
<div id="boardForm3" align="center">
<form id="editForm" method="post" action="${cPath }/boardqaUpdate.do" onsubmit="submitContents(this)">
<input type="hidden" name="qa_no" value="${boardqa.qa_no }"/>
<input type="hidden" name="qa_group" value="${boardqa.qa_group }"/>
<input type="hidden" name="qa_seq" value="${boardqa.qa_seq}"/>
<input type="hidden" name="qa_depth" value="${boardqa.qa_depth}"/>
<table>
	<tr>
		<th>제목</th>
		<td>
			<INPUT type="text" id="text" name="qa_title" value="${boardqa.qa_title }"/>
		</td>
	</tr>
	<tr>
		<th>작성자</th>
		<td>
			<INPUT type="text" id="text" name="qa_writer" value="${boardqa.qa_writer }"/>
		</td>
	</tr>
	<tr>
		<th>비밀번호</th>
		<td>
			<INPUT type="password" id="text" name="qa_pass"/>
		</td>
	</tr>
	<tr>
		<th>내용</th>
		<td>
			<TEXTAREA rows="5" cols="40" name="qa_content" id="ir1">${boardqa.qa_content }</TEXTAREA>
		</td>
	</tr>
	
	
</table><br><br>
			<input type="submit" value="수정하기" />
			<input type="button" value="목록가기" onclick="window.location.href='${cPath}/boardqaList.do'"/>
			<input type="button" value="삭제하기" 
			onclick="deleteBoardqa()"/>
</form>
</div>
<SCRIPT type="text/javascript">
var oEditors = [];
nhn.husky.EZCreator.createInIFrame({
    oAppRef: oEditors,
    elPlaceHolder: "ir1",
    sSkinURI: "${cPath}/se2/SmartEditor2Skin.html",
    fCreator: "createSEditor2"
});

function submitContents(elClickedObj) {
	   // 에디터의 내용이 textarea에 적용된다.
	   oEditors[0].exec("UPDATE_CONTENTS_FIELD", []);
	 
	   // 에디터에 입력된 내용의 검증은 이곳에서
	   // document.getElementById("ir1").value 값을 이용해서 처리한다.
	 
	   try{
	       // 이 라인은 현재 사용 중인 폼에 따라 달라질 수 있다.
// 	       elClickedObj.submit();
	   }catch(e){}
	}

</SCRIPT>
</body>
</html>